package com.kzw.oa.service.system;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kzw.core.service.hibernate.DefaultEntityManager;
import com.kzw.oa.model.system.Dictionary;

@Service
@Transactional(readOnly = true)
public class DictionaryService2 extends DefaultEntityManager<Dictionary, Long> {

	public String loadItem(String itemName) {
		String hql = "from Dictionary where itemName=? order by sn asc";
		List<Dictionary> list = findByHQL(hql, itemName);
		StringBuffer buff = new StringBuffer("[");
		for (Dictionary dic : list) {
			buff.append("[").append(dic.getDicId()).append(",'")
					.append(dic.getItemValue()).append("'],");

		}
		if (list.size() > 0) {
			buff.deleteCharAt(buff.length() - 1);
		}
		buff.append("]");
		return buff.toString();
	}

}
